// part1:C13:ex13.8.cpp
#include <iostream>
class HasPtr {
public:
  HasPtr(const std::string &s = std::string());
  HasPtr& operator=(const HasPtr &rhs);
private:
  std::string *ps;
  int i;
};

HasPtr& HasPtr::operator=(const HasPtr &rhs) {
  auto newps = new std::string(*rhs.ps);
  delete ps;
  ps = newps;
  i = rhs.i;
  return *this;
  
}
